using Cysharp.Threading.Tasks;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public partial class AudioBackgroundPanel : UIPanel
{
    private const string path = "Assets/Prefab/Audio_BackgroundPanel.prefab";
    public AudioBackgroundPanel() : base(new(path))
    {
    }

    public override void OnEnter()
    {
        base.OnEnter();

        YesButton.onClick.AddListener(async() =>
        {
            AudioManager.Instance.SetVolum(ClipKind.BackgoundMusic, 0.8f);

            await PanelManager.Instance.CreateUIPanel(new TillePanel(), UIManager.Instance.transform);
        });

        NoButton.onClick.AddListener(async() =>
        {
            AudioManager.Instance.Mute();

            await PanelManager.Instance.CreateUIPanel(new TillePanel(), UIManager.Instance.transform);
        });
    }
    public async override UniTask OnStop(bool useAnim)
    {
        await base.OnStop(useAnim);

        await PanelManager.Instance.CloseAllPanel();
    }
}
